Telegram Group & Telegram Channel
📚 Мини-справочник по основным типам данных C++

Делимся компактным справочником по основным типам данных в C++. Сохраняйте себе на будущее.

🔢 Целочисленные типы

int — 4 байта, от -2,147,483,648 до 2,147,483,647
short — 2 байта, от -32,768 до 32,767
long — 4 байта (Windows) или 8 байт (Unix)
long long — 8 байт, от -9,223,372,036,854,775,808 до 9,223,372,036,854,775,807

Модификаторы:
unsigned — только положительные числа, удваивает верхний предел
signed — со знаком (по умолчанию)


unsigned int counter = 100;
short temperature = -15;
long long population = 7800000000;


🔡 Символьные типы

char — 1 байт, обычные символы ASCII
wchar_t — 2 или 4 байта, широкие символы (Unicode)
char16_t — 2 байта, символы UTF-16 (C++11)
char32_t — 4 байта, символы UTF-32 (C++11)


char letter = 'A';
wchar_t unicodeChar = L'Ф';
char16_t utf16Char = u'Ж';


🔄 Числа с плавающей точкой

float — 4 байта, точность ~7 цифр, диапазон ±3.4e±38
double — 8 байт, точность ~15 цифр, диапазон ±1.7e±308
long double — 8-16 байт, точность ≥ double, диапазон зависит от компилятора


float price = 19.99f; // 'f' суффикс для float
double pi = 3.14159265359;
long double precise = 1.23456789123456789L; // 'L' суффикс


🧮 Логический тип

bool — 1 байт, значения: true или false


bool isActive = true;
bool hasPermission = false;


🗄 Производные типы

Массивы: int numbers[5];
Указатели: int* ptr;
Ссылки: int& ref = value;
Строки:
• C-строки: char str[] = "Hello";
• std::string: std::string text = "Hello";

🔄 Автоматическое определение типа (C++11)


auto x = 10; // int
auto y = 3.14; // double
auto z = "Hello"; // const char*


🧩 Тип Void

void — отсутствие типа (для функций без возвращаемого значения)
void* — указатель на данные любого типа

🔍 Как узнать размер типа




cout << "Размер int: " << sizeof(int) << " байт" << endl;


💡 Полезные советы

1. Используйте **size_t
для индексации и размеров
2. Для целых чисел с гарантированным размером используйте типы из <cstdint>: int32_t, uint64_t
3. Для денежных расчетов избегайте float из-за погрешностей округления

#cpp #programming

👉 @cpp_lib



tg-me.com/cpp_lib/1947
Create:
Last Update:

📚 Мини-справочник по основным типам данных C++

Делимся компактным справочником по основным типам данных в C++. Сохраняйте себе на будущее.

🔢 Целочисленные типы

int — 4 байта, от -2,147,483,648 до 2,147,483,647
short — 2 байта, от -32,768 до 32,767
long — 4 байта (Windows) или 8 байт (Unix)
long long — 8 байт, от -9,223,372,036,854,775,808 до 9,223,372,036,854,775,807

Модификаторы:
unsigned — только положительные числа, удваивает верхний предел
signed — со знаком (по умолчанию)


unsigned int counter = 100;
short temperature = -15;
long long population = 7800000000;


🔡 Символьные типы

char — 1 байт, обычные символы ASCII
wchar_t — 2 или 4 байта, широкие символы (Unicode)
char16_t — 2 байта, символы UTF-16 (C++11)
char32_t — 4 байта, символы UTF-32 (C++11)


char letter = 'A';
wchar_t unicodeChar = L'Ф';
char16_t utf16Char = u'Ж';


🔄 Числа с плавающей точкой

float — 4 байта, точность ~7 цифр, диапазон ±3.4e±38
double — 8 байт, точность ~15 цифр, диапазон ±1.7e±308
long double — 8-16 байт, точность ≥ double, диапазон зависит от компилятора


float price = 19.99f; // 'f' суффикс для float
double pi = 3.14159265359;
long double precise = 1.23456789123456789L; // 'L' суффикс


🧮 Логический тип

bool — 1 байт, значения: true или false


bool isActive = true;
bool hasPermission = false;


🗄 Производные типы

Массивы: int numbers[5];
Указатели: int* ptr;
Ссылки: int& ref = value;
Строки:
• C-строки: char str[] = "Hello";
• std::string: std::string text = "Hello";

🔄 Автоматическое определение типа (C++11)


auto x = 10; // int
auto y = 3.14; // double
auto z = "Hello"; // const char*


🧩 Тип Void

void — отсутствие типа (для функций без возвращаемого значения)
void* — указатель на данные любого типа

🔍 Как узнать размер типа




cout << "Размер int: " << sizeof(int) << " байт" << endl;


💡 Полезные советы

1. Используйте **size_t
для индексации и размеров
2. Для целых чисел с гарантированным размером используйте типы из <cstdint>: int32_t, uint64_t
3. Для денежных расчетов избегайте float из-за погрешностей округления

#cpp #programming

👉 @cpp_lib

BY Библиотека C/C++ разработчика


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/cpp_lib/1947

View MORE
Open in Telegram


Библиотека C C разработчика Telegram | DID YOU KNOW?

Date: |

The SSE was the first modern stock exchange to open in China, with trading commencing in 1990. It has now grown to become the largest stock exchange in Asia and the third-largest in the world by market capitalization, which stood at RMB 50.6 trillion (US$7.8 trillion) as of September 2021. Stocks (both A-shares and B-shares), bonds, funds, and derivatives are traded on the exchange. The SEE has two trading boards, the Main Board and the Science and Technology Innovation Board, the latter more commonly known as the STAR Market. The Main Board mainly hosts large, well-established Chinese companies and lists both A-shares and B-shares.

Export WhatsApp stickers to Telegram on Android

From the Files app, scroll down to Internal storage, and tap on WhatsApp. Once you’re there, go to Media and then WhatsApp Stickers. Don’t be surprised if you find a large number of files in that folder—it holds your personal collection of stickers and every one you’ve ever received. Even the bad ones.Tap the three dots in the top right corner of your screen to Select all. If you want to trim the fat and grab only the best of the best, this is the perfect time to do so: choose the ones you want to export by long-pressing one file to activate selection mode, and then tapping on the rest. Once you’re done, hit the Share button (that “less than”-like symbol at the top of your screen). If you have a big collection—more than 500 stickers, for example—it’s possible that nothing will happen when you tap the Share button. Be patient—your phone’s just struggling with a heavy load.On the menu that pops from the bottom of the screen, choose Telegram, and then select the chat named Saved messages. This is a chat only you can see, and it will serve as your sticker bank. Unlike WhatsApp, Telegram doesn’t store your favorite stickers in a quick-access reservoir right beside the typing field, but you’ll be able to snatch them out of your Saved messages chat and forward them to any of your Telegram contacts. This also means you won’t have a quick way to save incoming stickers like you did on WhatsApp, so you’ll have to forward them from one chat to the other.

Библиотека C C разработчика from sg


Telegram Библиотека C/C++ разработчика
FROM USA